import {reactive, ref} from 'vue'

//添加修改菜单信息
export interface MenuSaveOrUpdateParam {
    pid:string,
    menuType:string,
    menuName:string,
    menuIcon:string,
    menuRoute:string,
    menuInfoUrl:string,
    menuPower:string,
    menuSort:number,
    menuState:string
}
//添加修改对象
export let MenuSaveOrUpdateParam = ref<MenuSaveOrUpdateParam>({
    pid: '',
    menuType: '',
    menuName: '',
    menuIcon: '',
    menuRoute: '',
    menuInfoUrl: '',
    menuPower: '',
    menuSort: 0,
    menuState:  ''
});

export function MenuFromInfo(fromObj:any){
    MenuSaveOrUpdateParam.value.pid=fromObj!=null?fromObj.pid:"";
    MenuSaveOrUpdateParam.value.menuType=fromObj!=null?fromObj.menuType:"DIRECTORY";
    MenuSaveOrUpdateParam.value.menuName=fromObj!=null?fromObj.menuName:"";
    MenuSaveOrUpdateParam.value.menuIcon=fromObj!=null?fromObj.menuIcon:"CoffeeCup";
    MenuSaveOrUpdateParam.value.menuRoute=fromObj!=null?fromObj.menuRoute:"";
    MenuSaveOrUpdateParam.value.menuInfoUrl=fromObj!=null?fromObj.menuInfoUrl:"";
    MenuSaveOrUpdateParam.value.menuPower=fromObj!=null?fromObj.menuPower:"";
    MenuSaveOrUpdateParam.value.menuSort=fromObj!=null?fromObj.menuSort:0;
    MenuSaveOrUpdateParam.value.menuState=fromObj!=null?fromObj.isEnabled:"NORMAL";
}
